<%--
  Created by IntelliJ IDEA.
  User: bearworker
  Date: 17-4-23
  Time: 上午9:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>购买门票</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/easyui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/icon.css">
    <script type="application/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="application/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
</head>
<body style="align:center">
<div style="padding:10px 60px 20px 60px">
    <form method="post" action="${pageContext.request.contextPath}/all/ticket" id="tobuy">
        <table cellpadding="5">
            <tr>
                <td>姓名:</td>
                <td><input class="easyui-textbox" type="text" id="name" name="name" data-options="required:true" /></td>
            </tr>
            <tr>
                <td>手机号码:</td>
                <td><input class="easyui-textbox" type="text" id="cellno" name="cellno" data-options="required:true" /></td>
            </tr>
            <tr>
                <td>身份证号码:</td>
                <td><input class="easyui-textbox" type="text" id="cardno" name="cardno" data-options="required:true" /></td>
            </tr>
            <tr>
                <td>门票价格:</td>
                <td><input class="easyui-textbox" type="text" id="price" name="price" data-options="required:true" /></td>
            </tr>
        </table>
    </form>
    <div style="padding:5px">
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">购买</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清除</a>
    </div>
</div>

<script>
    function submitForm(){
        if ($('#name').val() == null || $('#cellno').val() == null || $('#cardno').val() == null || $('#price').val() == null) return;
        if ($('#name').val() == '' || $('#cellno').val() == '' || $('#cardno').val() == '' || $('#price').val() == '') return;
        $.post("${pageContext.request.contextPath}/all/ticket",{"name":$('#name').val(),"cellno":$('#cellno').val(),"cardno":$('#cardno').val(),"price":$('#price').val()},function(result){
            $.messager.alert('购买成功','购买成功!','info');
            clearForm();
        });
    }
    function clearForm(){
        $('#tobuy').form('clear');
        $('#name').val(null);
        $('#cellno').val(null);
        $('#cardno').val(null);
        $('#price').val(null);
    }
</script>
</body>
</html>
